package router

import (
	"api-gateway/basic/consts"
	"api-gateway/handler/api"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func LoadRouter(r *gin.Engine) {

	routerGroup := r.Group("v1")
	{
		apiUser := routerGroup.Group("api")
		{
			apiUser.POST("sendSms", api.SendSms)
			apiUser.POST("login", api.Login)
			apiUser.Use(jwt.JWTAuth(consts.KEY_SECRET_JWT))
			apiUser.POST("homePage", api.HomePage)
		}
		apiWork := routerGroup.Group("api")
		{
			apiWork.Use(jwt.JWTAuth(consts.KEY_SECRET_JWT))
			apiWork.POST("pubWork", api.PubWork)
			apiWork.POST("worksExamine", api.WorksExamine)
			apiWork.POST("subjectList", api.SubjectList)
			apiWork.POST("examineComment", api.ExamineComment)
		}
	}

}
